﻿using System;
using System.Collections.Generic;
using FluentNHibernate.Mapping;

namespace Model
{
    public class AchievementProgress
    {
        public virtual int ID { get; set; }
        public virtual Achievement Achievement { get; set; }
        public virtual DateTime? Completed { get; set; }
        private IList<AchievementCriteriaProgress> _criteriaProgress = new List<AchievementCriteriaProgress>();
        public virtual IList<AchievementCriteriaProgress> CriteriaProgress { get { return _criteriaProgress; } set { _criteriaProgress = value; } }
        public virtual Character Character { get; set; }
        public virtual Guild Guild { get; set; }
    }

    public class AchievementProgressMapping : ClassMap<AchievementProgress>
    {
        public AchievementProgressMapping()
        {
            Id(x => x.ID);
            Map(x => x.Completed);
            References(x => x.Achievement);
            References(x => x.Character);
            References(x => x.Guild);
            HasMany(x => x.CriteriaProgress);
        }
    }

    public class AchievementCriteriaProgress
    {
        public virtual int ID { get; set; }
        public virtual AchievementProgress AchievementProgress { get; set; }
        public virtual AchievementCriteria Criteria { get; set; }
        public virtual DateTime? Created { get; set; }
        public virtual DateTime? Completed { get; set; }
        public virtual int? Quantity { get; set; }
    }

    public class AchievementCriteriaProgressMapping : ClassMap<AchievementCriteriaProgress>
    {
        public AchievementCriteriaProgressMapping()
        {
            Id(x => x.ID);
            Map(x => x.Created);
            Map(x => x.Completed);
            Map(x => x.Quantity);
            References(x => x.AchievementProgress);
            References(x => x.Criteria);
        }
    }
}